Portable handheld electronic devices, such as the iPhone™ multifunction device by Apple Inc., have two general cellular telephony modes: speakerphone (or simply, speaker) mode and handset (or receiver) mode. A user generally operates the device in handset mode when he is holding the device near or against his ear, so that an audio signal from the other party of the call emits from the receiver (or earpiece speaker) of the device. A user generally operates the device in speaker mode when the device is situated away from his ear, so that an audio signal from the other party of the call emits from the speakerphone speaker (or loudspeaker) of the device (allowing the user to hear the other party without placing the device near his ear). When the device is being held against the user's ear during a phone call, a proximity detector automatically senses this condition, using an infrared sensor that is built into the device, and on that basis turns off the touch sensitive display screen of the device. The proximity detector can also automatically sense when the device is then moved away from the user's ear. When that happens, the device displays a set of virtual buttons on its touch screen which present various call handling functions such as end call, mute, keypad, and contacts list.